console.log("login");

function adaptor_login_success (payload, response, api, context) {
    if (response.data.status == 0) {
        localStorage.setItem("token", "sk-abc");
    }
    return response.data;
}


return {
  "type": "page",
  "title": "",
  "style": {
    "backgroundImage": "linear-gradient(180deg, #86a4e9, transparent)"
  },
  "cssVars": {
    "--Form-input-onFocused-borderColor": "#e8e9eb",
    "--Form-input-onHover-borderColor": "#e8e9eb"
  },
  "body": {
    "type": "grid-2d",
    "cols": 12,
    "grids": [
      {
        "x": 5,
        "y": 5,
        "h": 1,
        "w": 4,
        "width": 200,
        "type": "form",
        "mode": "horizontal",
        "title": "",
        "api": {
          "url": "${serverUrl}/api/login/",
          "method": "post",
          "dataType": "form-data",
          "adaptor": adaptor_login_success
        },
        "panelClassName": "p-r p-l p-b-md",
        "redirect": "/#/home",
        "body": [
          {
            "type": "tpl",
            "tpl": "<div style='text-align: center; font-weight: bold;'><p>管理后台</p></div>"
          },
          {
            "type": "input-text",
            "label": false,
            "name": "userName",
            "size": "full",
            "placeholder": "登陆名",
            "addOn": {
              "label": "",
              "type": "text",
              "position": "left",
              "icon": "fa fa-user"
            }
          },
          {
            "type": "input-password",
            "label": false,
            "name": "password",
            "size": "full",
            "placeholder": "密码",
            "addOn": {
              "label": "",
              "type": "text",
              "position": "left",
              "icon": "fa fa-lock"
            }
          },
          {
            "type": "checkbox",
            "label": false,
            "name": "record",
            "option": "记住密码"
          },
          {
            "type": "control",
            "label": false,
            "body": {
              "type": "button",
              "level": "primary",
              "actionType": "submit",
              "block": true,
              "label": "登陆",
              "size": "lg"
            }
          }
        ]
      }
    ]
  }
}